
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Module ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar</title>
<meta name="description" content="Documentation of Coq module ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar" />
<link href="coq2html.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="coq2html.js"> </script>
</head>

<body onload="hideAll('proofscript')">
<h1 class="title">Module ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar</h1>
<div class="coq">
<br/>
<div class="doc">Ergo is a language for expressing contract logic. </div>
<br/>
<h1> Syntactic sugar </h1>
<br/>
<span class="kwd">Require</span> <span class="kwd">Import</span> <span class="id"><a href="http://coq.inria.fr/library/Coq.Strings.String.html">String</a></span>.<br/>
<span class="kwd">Require</span> <span class="kwd">Import</span> <span class="id"><a href="http://coq.inria.fr/library/Coq.Lists.List.html">List</a></span>.<br/>
<span class="kwd">Require</span> <span class="kwd">Import</span> <span class="id"><a href="https://querycert.github.io/html/Qcert.NNRC.NNRCRuntime.html">Qcert.NNRC.NNRCRuntime</a></span>.<br/>
<span class="kwd">Require</span> <span class="kwd">Import</span> <span class="id"><a href="ErgoSpec.Common.Utils.Names.html">ErgoSpec.Common.Utils.Names</a></span>.<br/>
<span class="kwd">Require</span> <span class="kwd">Import</span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html">ErgoSpec.ErgoNNRC.Lang.ErgoNNRC</a></span>.<br/>
<span class="kwd">Require</span> <span class="kwd">Import</span> <span class="id"><a href="ErgoSpec.Backend.ErgoBackend.html">ErgoSpec.Backend.ErgoBackend</a></span>.<br/>
<br/>
<span class="kwd">Section</span> <span class="id"><a name="ErgoNNRCSugar">ErgoNNRCSugar</a></span>.<br/>
&nbsp;&nbsp;<span class="kwd">Open</span> <span class="kwd">Scope</span> <span class="id">string</span>.<br/>
<br/>
<div class="doc">Fresh variables </div>
&nbsp;&nbsp;<span class="kwd">Definition</span> <span class="id"><a name="fresh_in_match">fresh_in_match</a></span> {<span class="id">A</span>} (<span class="id">eccases</span>:<span class="id"><a href="http://coq.inria.fr/library/Coq.Init.Datatypes.html#list">list</a></span> (<span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#A">A</a></span> * <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span>)) (<span class="id">ecdefault</span>:<span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span>) :=<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id"><a href="https://querycert.github.io/html/Qcert.Utils.Fresh.html#fresh_var">fresh_var</a></span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"$<span class="kwd">match</span>"<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<span class="id"><a href="http://coq.inria.fr/library/Coq.Lists.List.html#app">List.app</a></span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<span class="id"><a href="http://coq.inria.fr/library/Coq.Lists.List.html#concat">List.concat</a></span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<span class="id"><a href="http://coq.inria.fr/library/Coq.Lists.List.html#map">List.map</a></span> (<span class="kwd">fun</span> <span class="id">eccase</span> =&gt; <span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRCVars.html#nnrc_free_vars">nnrc_free_vars</a></span> (<span class="id"><a href="http://coq.inria.fr/library/Coq.Init.Datatypes.html#snd">snd</a></span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#eccase">eccase</a></span>)) <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#eccases">eccases</a></span>))<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRCVars.html#nnrc_free_vars">nnrc_free_vars</a></span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#ecdefault">ecdefault</a></span>)).<br/>
<br/>
&nbsp;&nbsp;<span class="kwd">Definition</span> <span class="id"><a name="fresh_in_case">fresh_in_case</a></span> (<span class="id">pattern_expr</span>:<span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span>) (<span class="id">else_expr</span>:<span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span>) : <span class="id"><a href="http://coq.inria.fr/library/Coq.Strings.String.html#string">string</a></span> :=<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id"><a href="https://querycert.github.io/html/Qcert.Utils.Fresh.html#fresh_var">fresh_var</a></span> "$<span class="tactic">case</span>"<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<span class="id"><a href="http://coq.inria.fr/library/Coq.Lists.List.html#app">List.app</a></span> (<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRCVars.html#nnrc_free_vars">nnrc_free_vars</a></span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#pattern_expr">pattern_expr</a></span>) (<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRCVars.html#nnrc_free_vars">nnrc_free_vars</a></span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#else_expr">else_expr</a></span>)).<br/>
<br/>
&nbsp;&nbsp;<span class="kwd">Definition</span> <span class="id"><a name="fresh_in_lift_error">fresh_in_lift_error</a></span> (<span class="id">e</span>:<span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span>) :=<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id"><a href="https://querycert.github.io/html/Qcert.Utils.Fresh.html#fresh_var2">fresh_var2</a></span> "$<span class="id">lifte</span>" "$<span class="id">lifte</span>"<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRCVars.html#nnrc_free_vars">nnrc_free_vars</a></span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#e">e</a></span>).<br/>
&nbsp;&nbsp;<span class="kwd">Definition</span> <span class="id"><a name="fresh_in_lift_optional">fresh_in_lift_optional</a></span> (<span class="id">e</span>:<span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span>) :=<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id"><a href="https://querycert.github.io/html/Qcert.Utils.Fresh.html#fresh_var2">fresh_var2</a></span> "$<span class="id">lifto</span>" "$<span class="id">lifto</span>"<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRCVars.html#nnrc_free_vars">nnrc_free_vars</a></span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#e">e</a></span>).<br/>
<br/>
<div class="doc">New Array </div>
&nbsp;&nbsp;<span class="kwd">Definition</span> <span class="id"><a name="new_array">new_array</a></span> (<span class="id">el</span>:<span class="id"><a href="http://coq.inria.fr/library/Coq.Init.Datatypes.html#list">list</a></span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span>) : <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span> :=<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="kwd">match</span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#el">el</a></span> <span class="kwd">with</span><br/>
&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id"><a href="http://coq.inria.fr/library/Coq.Init.Datatypes.html#nil">nil</a></span> =&gt; <span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRC.html#NNRCConst">NNRCConst</a></span> (<span class="id"><a href="https://querycert.github.io/html/Qcert.Common.DataModel.Data.html#dcoll">dcoll</a></span> <span class="id"><a href="http://coq.inria.fr/library/Coq.Init.Datatypes.html#nil">nil</a></span>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;| <span class="id">e1</span>::<span class="id">erest</span> =&gt;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="id"><a href="http://coq.inria.fr/library/Coq.Lists.List.html#fold_left">fold_left</a></span> (<span class="kwd">fun</span> <span class="id">acc</span> <span class="id">e</span> =&gt; <span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRC.html#NNRCBinop">NNRCBinop</a></span> <span class="id"><a href="https://querycert.github.io/html/Qcert.Common.Operators.BinaryOperators.html#OpBagUnion">OpBagUnion</a></span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#acc">acc</a></span> (<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRC.html#NNRCUnop">NNRCUnop</a></span> <span class="id"><a href="https://querycert.github.io/html/Qcert.Common.Operators.UnaryOperators.html#OpBag">OpBag</a></span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#e">e</a></span>)) <span class="id">erest</span> (<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRC.html#NNRCUnop">NNRCUnop</a></span> <span class="id"><a href="https://querycert.github.io/html/Qcert.Common.Operators.UnaryOperators.html#OpBag">OpBag</a></span> <span class="id">e1</span>)<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="kwd">end</span>.<br/>
<br/>
<div class="doc"><span class="bracket"><span class="id">new</span> <span class="id">Concept</span>{ <span class="id">field1</span>: <span class="id">expr1</span>, ... <span class="id">fieldn</span>: <span class="id">exprn</span> }</span> creates a record and brands it with the concept name </div>
&nbsp;&nbsp;<span class="kwd">Definition</span> <span class="id"><a name="new_expr">new_expr</a></span> (<span class="id">brand</span>:<span class="id"><a href="http://coq.inria.fr/library/Coq.Strings.String.html#string">string</a></span>) (<span class="id">struct_expr</span>:<span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span>) : <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRC.html#nnrc_expr">nnrc_expr</a></span> :=<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRC.html#NNRCUnop">NNRCUnop</a></span> (<span class="id"><a href="https://querycert.github.io/html/Qcert.Common.Operators.UnaryOperators.html#OpBrand">OpBrand</a></span> (<span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#brand">brand</a></span> :: <span class="id"><a href="http://coq.inria.fr/library/Coq.Init.Datatypes.html#nil">nil</a></span>)) <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#struct_expr">struct_expr</a></span>.<br/>
<br/>
&nbsp;&nbsp;<span class="kwd">Section</span> <span class="id"><a name="ErgoNNRCSugar.Examples">Examples</a></span>.<br/>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="kwd">Definition</span> <span class="id"><a name="el1">el1</a></span> := (<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRC.html#NNRCConst">NNRCConst</a></span> (<span class="id"><a href="https://querycert.github.io/html/Qcert.Common.DataModel.Data.html#dnat">dnat</a></span> 1))::(<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRC.html#NNRCConst">NNRCConst</a></span> (<span class="id"><a href="https://querycert.github.io/html/Qcert.Common.DataModel.Data.html#dnat">dnat</a></span> 2))::(<span class="id"><a href="https://querycert.github.io/html/Qcert.cNNRC.Lang.cNNRC.html#NNRCConst">NNRCConst</a></span> (<span class="id"><a href="https://querycert.github.io/html/Qcert.Common.DataModel.Data.html#dnat">dnat</a></span> 3))::<span class="id"><a href="http://coq.inria.fr/library/Coq.Init.Datatypes.html#nil">nil</a></span>.<br/>
<br/>
&nbsp;&nbsp;<span class="kwd">End</span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#ErgoNNRCSugar.Examples">Examples</a></span>.<br/>
<span class="kwd">End</span> <span class="id"><a href="ErgoSpec.ErgoNNRC.Lang.ErgoNNRCSugar.html#ErgoNNRCSugar">ErgoNNRCSugar</a></span>.<br/>
<br/>

</div>
<div class="footer"><hr/>Generated by <a href="https://github.com/xavierleroy/coq2html/">coq2html</div>
</body>
</html>
